package com.budwk.app.sqfw.enums;

import lombok.Getter;

/**
 * 安全排查街道类型枚举
 *
 * @author zhangp
 * @date 2023-11-23l
 */
@Getter
public enum StreetEnum {

    JIN_YANG_STREET("JIN_YANG_STREET", "金阳街道"),
    YUN_TAN_STREET("YUN_TAN_STREET", "云潭街道"),
    DA_YING_LU_STREET("DA_YING_LU_STREET", "大营路街道"),
    WEI_QING_MEN_STREET("WEI_QING_MEN_STREET", "威清门街道"),
    HUA_GUO_YUAN_STREET("HUA_GUO_YUAN_STREET", "花果园街道"),
    YOU_ZHA_STREET("YOU_ZHA_JIE_STREET", "油榨街道"),
    CENTURY_CITY_STREET("CENTURY_CITY_STREET", "世纪城街道"),
    BYU("BYU", "白云区"),
    GSH("GSH", "观山湖"),
    NMQ("NMQ", "南明区");

    private final String code;

    private final String name;

    StreetEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * @param code
     * @return
     */
    public static String getName(String code) {
        for (StreetEnum o : StreetEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getName();
            }
        }
        return null;
    }

    public static String getCode(String name) {
        for (StreetEnum o : StreetEnum.values()) {
            if (o.getName().equals(name)) {
                return o.getCode();
            }
        }
        return null;
    }

    public static StreetEnum getStreetType(String name) {
        for (StreetEnum o : StreetEnum.values()) {
            if (name.contains(o.getName())) {
                return o;
            }
        }
        return null;
    }
}
